package com.derbysoft.synxisadapter.action.monitor.reservation;

import com.derbysoft.synxisadapter.action.BaseAdapterAction;
import com.derbysoft.synxisadapter.commons.model.Reservation;
import com.derbysoft.synxisadapter.commons.repository.ReservationRepository;
import com.opensymphony.xwork2.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;

@Results(value = {
    @Result(name = Action.SUCCESS,location = "/page/monitor/reservation/View.ftl")
})
public class ViewAction extends BaseAdapterAction {
    @Autowired
    private ReservationRepository reservationRepository;

    private String ersp;

    private Reservation reservation;

    public String execute() throws Exception {
        reservation = reservationRepository.findByErspCode(ersp);
        return SUCCESS;
    }

    public String getErsp() {
        return ersp;
    }

    public void setErsp(String ersp) {
        this.ersp = ersp;
    }

    public Reservation getReservation() {
        return reservation;
    }
}

